package com.yiwyn.demo.utils.modify.handle.event.base;

import com.yiwyn.demo.utils.modify.entity.ModifyEntity;

import java.util.HashMap;
import java.util.Map;

public abstract class BaseTypeEvent<T> {


    protected Map<String, BaseEvent> eventMap = new HashMap<>();


    public BaseTypeEvent() {
        this.registerEvent();
    }

    public void registerEvent() {

    }

    public void triggerEvent(String eventId, ModifyEntity.ModifyItem modifyItem) {
        BaseEvent baseEvent = eventMap.get(eventId);
        if (baseEvent != null) {
            baseEvent.trigger(modifyItem);
        }
    }

}
